package com.example.spring.demo.common.local;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2024/12/31 14:02
 **/
public class UserContextHolder {

    private static final ThreadLocal<UserContext> contextHolder = new ThreadLocal<>();

    public static void setContext(UserContext context) {
        contextHolder.set(context);
    }

    public static UserContext getContext() {
        return contextHolder.get();
    }

    public static void clearContext() {
        contextHolder.remove();
    }
}
